<template>
  <div class="administrator">
    <mains :title="'报告详情'"></mains>
    <!-- 内容 -->
    <div class="info">
      <!-- 体检人信息 -->
      <div class="info-container">
        <h3 class="text-center">体检人信息</h3>
        <ul class="info-list">
          <li class="info-item">
            <span class="info-label">姓名：</span>
            <span class="info-value">{{ list.name }}</span>
          </li>
          <li class="info-item">
            <span class="info-label">性别：</span>
            <span class="info-value">{{ list.sex }}</span>
          </li>
          <li class="info-item">
            <span class="info-label">年龄：</span>
            <span class="info-value">{{ list.age }}</span>
          </li>
          <li class="info-item">
            <span class="info-label">证件号码：</span>
            <span class="info-value">{{ list.self }}</span>
          </li>
          <li class="info-item">
            <span class="info-label">套餐名称：</span>
            <span class="info-value">{{ list.clasz }}</span>
          </li>
          <li class="info-item">
            <span class="info-label">报告时间：</span>
            <span class="info-value">{{ list.yvTime }}{{ list.time }}</span>
          </li>
        </ul>
      </div>
      <!-- 报告详情 -->
      <div class="report-detail">
        <h3 class="text-center">报告详情</h3>
        <div class="content">
          <div class="left">
            <div class="top">
              <span>项目名称: </span>
              <span class="weight">常规检查</span>&nbsp;
              <span>项目编号: </span>
              <span class="weight">{{ list.card }}</span>
            </div>
             <div class="report-table">
            <table>
              <thead>
                <tr>
                  <th>项目名称</th>
                  <th>检查结果</th>
                  <th>参考值</th>
                </tr>
              </thead>
              <tbody>
                <tr>
                  <td>身高</td>
                  <td>{{list.shengao}}cm</td>
                  <td></td>
                </tr>
                <tr>
                  <td>体重</td>
                  <td>{{list.tizhong}}kg</td>
                  <td></td>
                </tr>
                <tr>
                  <td>BMI</td>
                  <td>{{ list.BMI }}</td>
                  <td>18.5-22.9</td>
                </tr>
                <tr>
                  <td>血压(收缩压)</td>
                  <td>{{list.xyssy}}</td>
                  <td>90-140</td>
                </tr>
                <tr>
                  <td>血压(舒张压)</td>
                  <td>{{list.xyszy}}</td>
                  <td>60-90</td>
                </tr>
              </tbody>
            </table>
          </div>
          </div>
           <div class="left">
            <div class="top">
              <span>项目名称: </span>
              <span class="weight">常规检查</span>&nbsp;
              <span>项目编号: </span>
              <span class="weight">19{{ list.card }}</span>
            </div>
             <div class="report-table">
            <table>
              <thead>
                <tr>
                  <th>项目名称</th>
                  <th>检查值</th>
                  <th>参考范围</th>
                </tr>
              </thead>
              <tbody>
                <tr>
                  <td>血红蛋白</td>
                  <td>{{ list.xhdb }}</td>
                  <td>参考范围：115~150g/L</td>
                </tr>
                <tr>
                  <td>体重</td>
                  <td>65kg</td>
                  <td></td>
                </tr>
                <tr>
                  <td>BMI</td>
                  <td>19.0</td>
                  <td>18.5-22.9</td>
                </tr>
                <tr>
                  <td>血压(收缩压)</td>
                  <td>{{list.xyssy}}</td>
                  <td>90-140</td>
                </tr>
                <tr>
                  <td>血压(舒张压)</td>
                  <td>{{list.xyszy}}</td>
                  <td>60-90</td>
                </tr>
              </tbody>
            </table>
          </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import mains from '@/components/main.vue'
import { onMounted, ref } from 'vue'
import { useRouter } from 'vue-router'
import { getList } from '@/ncApi/registerApi'
const router = useRouter()
// 获取页面传过来的id
const id = JSON.parse(router.currentRoute.value.query.id)
const currentPage = ref(1)
const pageSize = ref(10)
console.log('ids', id)
const list = ref([])
const getTableList = async () => {
  const res = await getList({ pageNum: currentPage.value, pageSize: pageSize.value })
  console.log('res111', res.data.list)
  let list1 = await res.data.list.find(item => item.id === id)
  console.log("数据",list1)
  list.value = list1
}
onMounted(() => {
  getTableList()
})
</script>
<style scoped>
.report-detail .content .left {
  width: 48%;
}
.report-detail .content .left span{
  color:grey;
}
.report-detail .content .left .weight{
  font-weight: 500;
  color:#000;
}
.content {
  width: 95%;
  margin: 25px auto;
  display: flex;
  justify-content: space-between;
}
.report-detail {
  margin-left: 12px;
  width: 98%;
  height: 500px;
  background: #fff;
  border-radius: 10px;
  box-sizing: border-box;
  margin-top: 20px;
}
.info-list li {
  list-style: none;
  width: 30%;
  margin-bottom: 20px;
}
.info-list {
  width: 95%;
  margin: 25px auto;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
}
.text-center {
  color: #1d6aee;
  font-weight: 600;
  width: 100%;
  background-color: #efeeee;
  height: 40px;
  padding: 5px 0 5px 20px;
  line-height: 30px;
  border-radius: 10px 10px 0 0;
}
.info-container {
  margin-left: 12px;
  width: 98%;
  height: 150px;
  background: #fff;
  border-radius: 10px;
  box-sizing: border-box;
}
.report-table {
  width: 100%;
  margin-top: 40px;
}

.report-table table {
  width: 100%;
  min-width: 400px; /* 防止表格过窄 */
  border-collapse: collapse;
  margin: 0;
}

.report-table th,
.report-table td {
  padding: 12px 20px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
}

.report-table th {
  background: #f5f7fa;
  font-weight: 500;
  color: #333;
}

.report-table td {
  color: #666;
}
</style>
